//Monday, October 26 2009
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class CrazyBot
{
	public:
	int n;
// This array stores all points visitied by robot
	vector<vector<bool> > visit;//(2*n+2, vector<bool>(2*n+2, false));
	double E;
	double W;
	double S;
	double N;
	double P;
	double getProbability(int n1, int east, int west, int south, int north)
	{
		n = n1;
		E = 1.0 * east / 100;
		W = 1.0 * west / 100;
		S = 1.0 * south / 100;
		N = 1.0 * north / 100;
		P = 0.0;

		for(int i=0; i<=2*n+2; i++)
		{
			vector<bool> v;
			for(int j=0; j<=2*n+2; j++)
				v.push_back(false);
			visit.push_back(v);
		}
		dfs(n, n, 0, 1.0);
		return P;
	}
	void dfs(int x, int y, int step, double prob)
	{
// If we stay at the point which was already visited, then we stop checking this path.
		if(visit[x][y]) return;
// If we made N steps without visiting the same point twice, then we add the probability of this path to the answer.
		if(step >= n)
		{
			P += prob;
			return;
		}
		visit[x][y] = true;
		dfs(x+1, y, step+1, prob*E);
		dfs(x-1, y, step+1, prob*W);
		dfs(x, y+1, step+1, prob*N);
		dfs(x, y-1, step+1, prob*S);
// Unmark the point when we checked all paths.
		visit[x][y] = false;
	}
};
